package io.work;

import java.io.File;
import java.io.FileOutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class testNote {
    public static void main(String[] args) throws Exception {
        File file=new File("note.txt");
        FileOutputStream fos=new FileOutputStream(file);
        Scanner s=new Scanner(System.in);
        System.out.println("单独输入exit结束记事本");
        while (true){
            String str=s.nextLine();


            if ("exit".equals(str)){
                System.out.println("输入结束");
                break;
            }

            fos.write(str.getBytes(StandardCharsets.UTF_8));
            fos.write(10);//换行
        }
    }
}
